package com.yjs.ppjokedemo.ui.detail;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bumptech.glide.Glide;
import com.yjs.ppjokedemo.R;

@Route(path = "/app/SofaPicDetailActivity")
public class SofaPicDetailActivity extends AppCompatActivity {

    @Autowired
    Bundle dataBean;

    private FrameLayout titleLayout;
    private ImageView actionClose;
    private TextView title;
    private ImageView ivSofaPicTou;
    private TextView tvSofaAuthorName;
    private Button picDetailBt;
    private ImageView ivPicDetail;
    private TextView inputViewSofaPic;
    private ImageView ivLikePic;
    private ImageView ivLikeCollect;
    private ImageView ivLikeShare;
    private TextView tvPicCaption;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sofa_pic_detail);
        initView();

        actionClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                ARouter.getInstance()
//                        .build("/app/PicFragment")
//                        .navigation(SofaPicDetailActivity.this);
                finish();
            }
        });
    }

    private void initView() {
        //参数注入
        ARouter.getInstance().inject(this);
        titleLayout = (FrameLayout) findViewById(R.id.title_layout);
        actionClose = (ImageView) findViewById(R.id.action_close);
        title = (TextView) findViewById(R.id.title);
        ivSofaPicTou = (ImageView) findViewById(R.id.iv_sofa_picTou);
        tvSofaAuthorName = (TextView) findViewById(R.id.tv_sofa_authorName);
        picDetailBt = (Button) findViewById(R.id.pic_detail_bt);
        ivPicDetail = (ImageView) findViewById(R.id.iv_pic_detail);
        inputViewSofaPic = (TextView) findViewById(R.id.input_view_sofaPic);
        ivLikePic = (ImageView) findViewById(R.id.iv_like_pic);
        ivLikeCollect = (ImageView) findViewById(R.id.iv_like_collect);
        ivLikeShare = (ImageView) findViewById(R.id.iv_like_share);
        tvPicCaption = (TextView) findViewById(R.id.tv_pic_caption);

        tvSofaAuthorName.setText(dataBean.getString("name"));
        tvPicCaption.setText(dataBean.getString("caption"));
        Glide.with(this)
                .load(dataBean.getString("ivTou"))
                .circleCrop()
                .into(ivSofaPicTou);

        Glide.with(this)
                .load(dataBean.getString("imagUrl"))
                .into(ivPicDetail);




    }
}